package org.grow.testing.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.time.LocalDateTime;


/**
 * @Author: xwg
 * @CreateDate: 21-8-3
 */

@RestController
@RequestMapping("/testing")
@EnableSwagger2
public class AnotherTest {
    @PutMapping("/test01")
    public String test01(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        System.out.println(authentication.getPrincipal().getClass());
        System.out.println("访问人员： "+authentication.getName());
        return "zhangsan";
    }

}
